﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using O.M.Production.Application.IService;
using O.M.Production.Domain.Entity;
using O.M.Production.ErrorCodeEnum;
using System.Linq.Expressions;

namespace O.M.Production.Read.API.Controllers
{
    /// <summary>
    /// Api控制器-生产计划 
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Read_Production_PlanController : ControllerBase
    {
        private readonly I_production_plan_Service _production_plan_service;

        public Read_Production_PlanController(I_production_plan_Service production_plan_service)
        {
            _production_plan_service = production_plan_service;
        }

        /// <summary>
        /// 分页显示-生产计划列表
        /// </summary>
        /// <param name="production_plan_id_Name">生产计划id或名称</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="pageIndex">页码</param>
        /// <returns>统一返回格式</returns>
        [HttpGet]
        public async Task<IActionResult> Get_production_plan(string? production_plan_id_Name, int pageSize, int pageIndex)
        {
            try
            {
                var list=await _production_plan_service.Get_production_plan(production_plan_id_Name, pageSize, pageIndex);
                return Ok(list);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }
    }
}
